# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html

# Sets the minimum version of CMake required to build the native library.

# 设置构建本机所需库的cmake最低版本
cmake_minimum_required(VERSION 3.4.1)

# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.

#创建并命名库，将其设置为静态的或共享的，并气功其源代码的相对路径
#可以定义多个library库，并使用cmake来构建
#Gradle会自动将包共享库关联到apk程序
add_library(
             #设置库的名称
             # Sets the name of the library.
             native-lib

             #将库设置为共享库
             # Sets the library as a shared library.
             SHARED

             #为源文件提供一个相对路径
             # Provides a relative path to your source file(s).
             src/main/cpp/native-lib.cpp )

# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.


#搜索指定预先构建的库和存储路径变量，因为CMake包括在系统搜索路径中，在默认情况下，只需要添加指定的公共 NDK 库名称
find_library( # Sets the name of the path variable.
              # 设置path变量的名称
              log-lib

              # Specifies the name of the NDK library that
              # you want CMake to locate.
              #在CMake定位前指定NDK库的名称
              log )

# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.

#指定CMake应该连接到的目标库中，可以连接多个库，比如定义库，构建脚本，预先构建的第三方库或者系统库
target_link_libraries( # Specifies the target library.
                       #指定目标库
                       native-lib

                       # Links the target library to the log library
                       # included in the NDK.
                       #目标库到日志库的链接，包含在 NDK
                       ${log-lib} )